package com.libgdxbar.pvzlikegame.systems.render;

import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;

import org.libgdxbar.projects.interfaces.renderer.IShapeRender;

/**
 * 形状渲染代理类，实现了 {@link IRenderAgent} 接口，用于渲染 {@link IShapeRender} 对象
 */
public class ShapeRenderAgent implements IRenderAgent<IShapeRender> {

	private final ShapeRenderer batch;

	public ShapeRenderAgent(ShapeRenderer batch) {
		this.batch = batch;
	}

	@Override
	public void setView(Camera camera) {
		this.batch.setProjectionMatrix(camera.combined);
	}

	@Override
	public void begin() {
		this.batch.begin();
	}

	@Override
	public void render(IShapeRender renderer) {
		renderer.render(batch);
	}

	@Override
	public void end() {
		this.batch.end();
	}
}

